package com.li.sta.schedule;

import com.li.sta.service.StatisticsDailyService;
import com.li.sta.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class ScheduleTask {

    @Autowired
    private StatisticsDailyService staService;

   /* @Scheduled(cron = "0 0 12 * * ?")
    public void task(){
        System.out.println("^^^^^^^^^^^^sta来了");
    }*/

    //在每天的12点,把前一天的数据查询添加
    @Scheduled(cron = "0 0 12 * * ?")
    public void sta(){
        staService.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(),-1)));
    }
}
